Graphics application programming interfaces (“API”) are used by programmers to create 2D and 3D graphics. The Open Graphics Library (“Open GL”) is a widely used API. The Open GL architecture allows programmers to produce consistent visual display results on any OpenGL API-compliant hardware regardless of the operating system. OpenGL for embedded systems (“OpenGL ES”) is a subset of the OpenGL API designed for embedded devices such as mobile phones, PDAs, and video game consoles.
OpenGL and OpenGL ES may use “textures” or images that are generally used to give 3d objects greater detail. For example, as shown in FIG. 1A, cube 100 is not textured. FIG. 1B depicts a texture 102 which may be applied to cube 100 to generate cube 104 shown in FIG. 1C. When cube 104 is drawn, the system must determine which colors to draw it and make the texture “fit” to the object. In one example, for each pixel in cube 104, the system will choose 1 or 4 pixels from texture 102 and average them together. Which pixels the system selects may vary depending upon the texture and the object. For example, if the texture of FIG. 1B is red, white and blue, the system may select a red, white or blue pixel. As a result of using these averages, when cube 104 is rotated, the cube may actually flicker different colors as it moves around the view.
In order to avoid flickering and increase efficiency, OpenGL and OpenGL ES may use “mipmapping.” Mipmapping allows the system to generate smaller versions of textures called “mipmaps” or “mips.” Each mip may be ¼ the size of the previous one. For each mip, the colors of the original texture (or the next larger mip) may be used to compute what color the smaller mip should be. As shown in FIG. 1D, mips 105-112 may be considered smaller versions of texture 102, each being some combination of red, white, and blue pixels. The smallest mip may be a 1×1 pixel map. FIG. 1E is an enlargement of mips 107-112.
When the system draws a cube with a texture that uses mips, it may choose the appropriately sized mip. For example, if the cube is so small or far away that it is only 1 pixel large, the system will choose the smallest mip. If there is only 1 pixel in the smallest mip, the flickering may now be fixed. In some examples, the mips may make the image clearer. For example, FIG. 1F depicts two textured cubes, 115 drawn using the “average” method described above and 116 using the “mip” method.
Most of the various versions of OpenGL allow texture to be drawn in any dimension up to a certain maximum size. The base specifications for OpenGL and OpenGL ES require that if (a) a texture has mips and (b) the texture has been set to use mips, the texture's dimensions must be a power of 2. In other words, the width and height of the texture must be 1, 2, 4, 8, 16, 32, 64, 128, etc., up to the maximum power of two that the particular version of GL allows. For example, a texture that is 128×64 pixels is a power of 2 (“POT”) texture. A texture that is 127×64 is a non power of 2 (“NPOT”) texture. The base OpenGL specification designates NPOTs as an error. As a result, the system will ignore the NPOT texture and instead treat the texture as though it was all black. Many versions of OpenGL have optional extensions which remove this restriction. These extensions allow NPOT textures to be drawn just like POT textures.
However, many computing systems do not support these extensions. If a programmer prepares a program assuming that the extensions exist (as they do on his personal machine), he may prepare his program only later to discover that the program may not work on systems which do not utilize these extensions.